package org.demo.patten.strategy;

/**
 * @author zhuj
 * @date 2025/3/29
 * @apiNote
 */
public class PriceCalculator {
    private DiscountStrategy strategy;
    public PriceCalculator(DiscountStrategy strategy) {
        this.strategy = strategy;
    }
    public void setStrategy(DiscountStrategy strategy) {
        this.strategy = strategy;
    }
    public double calculate(double price) {
        return strategy.applyDiscount(price);
    }
}